package com.ssy.lingxi.product.repository.warehouse;

import com.ssy.lingxi.product.entity.warehouse.Invoices;
import com.ssy.lingxi.product.entity.warehouse.InvoicesDetails;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import javax.validation.constraints.Max;
import java.util.List;
import java.util.Optional;
import java.util.Set;

/**
*单据详情
* @author wrc
* @date 2020/7/6
*/
@Repository
public interface InvoicesDetailsRepository extends JpaRepository<InvoicesDetails, Long>, JpaSpecificationExecutor<InvoicesDetails> {

    /**
    * 根据单据信息查询详情
    * @author wrc
    * @date 2020/7/6
    */
    List<InvoicesDetails> findAllByInvoicesIdIn(List<Long> invoicesIds);

    @Transactional
    void deleteAllByInvoicesIn(List<Invoices> invoicess);

    @Transactional
    void deleteAllByInvoices(Invoices invoices);

    /**
    * 根据单据iD查询单据详情
    * @author wrc
    * @date 2020/7/8
    */
    List<InvoicesDetails> findByInvoicesIdEquals(Long invoicesId);

}
